From 4f01c02a04356916729ecee1dc0a1726ee2f5339 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 31 Aug 2016 16:13:26 -0700 Subject: [PATCH] Verify `cargo package` rejects path dependencies. Port of the equivalent test from the `cargo publish` command. --- tests/package.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/package.rs b/tests/package.rs index b953c3916..c9bbfd0f7 100644 --- a/tests/package.rs +++ b/tests/package.rs @@ -206,6 +206,37 @@ fn package_verification() { dir = p.url()))); } +#[test] +fn path_dependency_no_version() { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + license = "MIT" + description = "foo" + + [dependencies.bar] + path = "bar" + "#) + .file("src/main.rs", "fn main() {}") + .file("bar/Cargo.toml", r#" + [package] + name = "bar" + version = "0.0.1" + authors = [] + "#) + .file("bar/src/lib.rs", ""); + + assert_that(p.cargo_process("package"), + execs().with_status(101).with_stderr("\ +[WARNING] manifest has no documentation, homepage or repository. See http://doc.crates.io/manifest.html#package-metadata for more info. +[ERROR] all path dependencies must have a version specified when packaging. +dependency `bar` does not specify a version. +")); +} + #[test] fn exclude() { let p = project("foo") -- 2.30.2